<template>
  <!-- 3_1项目实施-列表 -->
  <div>

    <div class="table-wrap" v-if="!taskShow">
      <div class="table-top">
        <a-input-search placeholder="请输入内容" v-model="search" class="search" @search="onSearch" />
        <a-button type="primary" class="buttonColorGreen ml10 mr10">查询</a-button>
        <a-button type="primary" class="buttonColorGreen ml10 mr10" @click="reset">重置</a-button>
      </div>
      <div class="table">
        <a-table :columns="columns" :dataSource="tableData" bordered>
          <template slot="name" slot-scope="text">
            {{text}}
          </template>
          <span slot="operation">
            <span class="actionButton" @click="taskShow=true">
              <a-icon type="check-circle" />详情</span>
          </span>
          <span slot="detail">
            <router-link to="" class="actionButton">
              <a-icon type="check-circle" />修改</router-link>
          </span>
        </a-table>
      </div>
    </div>
    <Task v-if="taskShow" :taskShow.sync="taskShow"></Task>
  </div>

</template>

<script>
import Task from './task'
const columns = [{   //表格表头
  title: '序号',
  dataIndex: 'number',
  scopedSlots: { customRender: 'number' },
},
{
  title: '项目名称',
  className: 'objectName',
  dataIndex: 'objectName',
},
{
  title: '项目编号',
  dataIndex: 'objectNum',
},
{
  title: '登记时间',
  dataIndex: 'checkinTime',
},
{
  title: '项目经理',
  dataIndex: 'manager',
},
{
  title: '项目类型',
  dataIndex: 'objectType',
},
{
  title: '进度',
  dataIndex: 'status',
},
{
  title: '状态',
  dataIndex: 'schedule',
},
{
  title: '花费时间(天)',
  dataIndex: 'spendTime',
},
{
  title: '操作',
  scopedSlots: { customRender: 'operation' },
},
{
  title: '操作',
  // dataIndex: 'operation',
  scopedSlots: { customRender: 'detail' },
}
];

const tableData = [//表格数据
  {
    number: '1',
    objectName: '南昌县A项目',
    objectNum: '￥300,000.00',
    checkinTime: 'New York No',
    objectType: '软件型',
    manager: "张三",
    schedule: '国土局',
    status: "正在进行",
    spendTime: 30
  },
  {
    number: '2',
    objectName: '南昌县A项目',
    objectNum: '￥1,256,000.00',
    checkinTime: 'London No',
    objectType: '软件型',
    manager: "张三",
    schedule: '国土局',
    status: "正在进行",
    spendTime: 30
  },
  {
    number: '3',
    objectName: '南昌县A项目',
    objectNum: '￥120,000.00',
    checkinTime: 'Sidney No',
    objectType: '软件型',
    manager: "张三",
    schedule: '国土局',
    status: "正在进行",
    spendTime: 30
  }
];

export default {
  components: {
    Task
  },
  data() {
    return {
      tableData,
      columns,
      search: '',
      taskShow: false
    }
  },
  methods: {
    onSearch() {   //搜索

    },
    onDelete(key) {  //删除
      const dataSource = [...this.dataSource]
      this.dataSource = dataSource.filter(item => item.key !== key)
    },
    reset() {  //重置
      this.search = ""
    }
  }
}
</script>

